/*
package com.jay.base.lambda;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

*/
/**
 * Created by caoyuan7 on 2019/1/11.
 *//*

public class FunctionInterfaceTest {
    private static void func(FunctionInterface functionInterface) {
        int x = 2;
        functionInterface.test(x);
    }

    public static void main(String args[]){
//        func(new FunctionInterface() {
//            @Override
//            public void test() {
//                System.out.println("Hello World!");
//            }
//        });
        //使用Lambda表达式代替上面的匿名内部类
        //func((int x) ->{ System.out.println("Hello World"+x);return true;});
        int count = 0;
        List<Student> list = new ArrayList<>();
        Student t1 = new Student();
        t1.setCity("chengdu");
        t1.setName("caoy");
        Student t2 = new Student();
        t2.setCity("henan");
        t2.setName("zhangsan");
        list.add(t1);
        list.add(t2);
        //count = (int)list.stream().filter((student -> student.getCity().equals("chengdu"))).count();

        list.forEach(t->{ System.out.println(t.getCity());});
//        for(Iterator it = list.iterator();it.hasNext();){
//            Student student = (Student)it.next();
//            System.out.println(student.getCity());
//        }

        //System.out.println(count);


    }
}
class Student{
    String city;
    String name;

    public String getCity() {
        return city;
    }

    public void setCity(String city) {
        this.city = city;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
}
*/
